UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EJ9x0eLK0GiJfOOt+dkcxhquUWPLd1GmMzjAR5pHe38=' 
WHERE 
  key_id = '81510639e08cffe447e0567987d29975e342770fb521a8b35153ba0dd7d57149' 
  AND (
    token = 'EJ9x0eLK0GiJfOOt+dkcxhquUWPLd1GmMzjAR5pHe38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020