UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H5qKdAPnH05YuvZ2Bx9VByn4o1WzCC+AeRvlpq8yvUs=' 
WHERE 
  key_id = '0830f30169f5051d8c0b7b4de6e74e2d29af59144c7287d5fe63253095b4fbe0' 
  AND (
    token = 'H5qKdAPnH05YuvZ2Bx9VByn4o1WzCC+AeRvlpq8yvUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044