UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ngCMfZ4jU7sZUWxtl8Sy+HB3jPJBmMxMlzMCnpzuMVg=' 
WHERE 
  key_id = '9d3b5c9ecde9944f54734db8588cb8cc820e620c947b73f533d49ec31f3fc7f6' 
  AND (
    token = 'ngCMfZ4jU7sZUWxtl8Sy+HB3jPJBmMxMlzMCnpzuMVg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048