UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mIZwedXF68xeCXaCQFJ/5ww25YgCKrrms6cJBkoFdAw=' 
WHERE 
  key_id = '621cc71993c65b6f06f5edc885a272497eb42b79287429c7fc1200a536255e51' 
  AND (
    token = 'mIZwedXF68xeCXaCQFJ/5ww25YgCKrrms6cJBkoFdAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017