UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'POxnvfqrR77oYjk6bMMQ4EerYgSk2hIRjwfBCLi6cWs=' 
WHERE 
  key_id = '78eb49bc56d016090fe327577cc762e0645880c3de057e24b0d64e5c3addf842' 
  AND (
    token = 'POxnvfqrR77oYjk6bMMQ4EerYgSk2hIRjwfBCLi6cWs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038