UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sb3KsXE4R6MifAsAMt0idyQ7MqE11MR8izmdPx+fFio=' 
WHERE 
  key_id = '9f0d57a78c6114694cf83f22c0348fb630e36d53cc2dfb31ada9e9dc3e08facd' 
  AND (
    token = 'sb3KsXE4R6MifAsAMt0idyQ7MqE11MR8izmdPx+fFio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046