UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e0yaotklexAjU/t2ONavEitAdBp/jk1geAPnJEKrXoU=' 
WHERE 
  key_id = '087945853ea24f031899ab735d54727f81af08019725db3e46e3472ba85b0257' 
  AND (
    token = 'e0yaotklexAjU/t2ONavEitAdBp/jk1geAPnJEKrXoU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022