UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'znh+Ho9P2H7DXOC8YAe1LSTe4uCGugZrz/tgZpplHZE=' 
WHERE 
  key_id = '07bac3541df8eb180c285b64895560d6166c1606c2e5b39497522c5e5aad990a' 
  AND (
    token = 'znh+Ho9P2H7DXOC8YAe1LSTe4uCGugZrz/tgZpplHZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049