UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ms+yojaW6ky1m2Ed9XIpefDBzZqB48AFWVyChVczlbg=' 
WHERE 
  key_id = '7857960d5829abedb8d546d6cff6718b8522b40987d443cce3f706a417572631' 
  AND (
    token = 'ms+yojaW6ky1m2Ed9XIpefDBzZqB48AFWVyChVczlbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033