UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XNGs5MVgfAIT9Rxp6t1xqohmZik9b+eD4V4M5JKbbqY=' 
WHERE 
  key_id = '840c97f378b0aee40dd2dd89df28a1cfde3c42d399c4a0ae2402bff1cbed8244' 
  AND (
    token = 'XNGs5MVgfAIT9Rxp6t1xqohmZik9b+eD4V4M5JKbbqY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035