UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HWhOe0QEW34wfKwHP34c0SPU60g0cC8gmS6RoNzwXUI=' 
WHERE 
  key_id = '0cee7c444c9b877218d8cc38c63960e6fdc975bb852b1d63da089c813885ba77' 
  AND (
    token = 'HWhOe0QEW34wfKwHP34c0SPU60g0cC8gmS6RoNzwXUI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028