UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QaZYidw0c4+8xg+JmsoEhRUJ2TImlXLmYUEY1HvMtG4=' 
WHERE 
  key_id = '9999e73cd85879b56f83528518222f94bba39a04925cb50fdadcc7950b04c9d5' 
  AND (
    token = 'QaZYidw0c4+8xg+JmsoEhRUJ2TImlXLmYUEY1HvMtG4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054