UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E8IcIx4lfXDMLqfJKXy3pwM3CWcciGwNc69ybiknr+s=' 
WHERE 
  key_id = '38f51f63fa6b03d37a2f8db1564442339b28dae4cee48f8fda9ec3d53725cd5a' 
  AND (
    token = 'E8IcIx4lfXDMLqfJKXy3pwM3CWcciGwNc69ybiknr+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045