UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JvEIfwIwmwyyNGV6EJn9mpaFgdjPU3nOaUZjDFuKGrU=' 
WHERE 
  key_id = '5c4c2a63b37ad1179ec93a57586816201d816753cc77f7baa08ecf42bbf6f529' 
  AND (
    token = 'JvEIfwIwmwyyNGV6EJn9mpaFgdjPU3nOaUZjDFuKGrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038