UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'orgcrNrdsDSVYgIdhr7cd1JQU9x25YexRqWSAHe49w0=' 
WHERE 
  key_id = '351e1ecb769002f621e3f24675802758b2bbe489a49d8ec408c78db2ce41296e' 
  AND (
    token = 'orgcrNrdsDSVYgIdhr7cd1JQU9x25YexRqWSAHe49w0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023