UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rrJWTR9H869ipBdpXCCQR1TStqaa0UrEn29lyXCfD38=' 
WHERE 
  key_id = 'b9200397422d487dc47e12f145a5329bf533442dd43d2e24e31adbed9d22b3e0' 
  AND (
    token = 'rrJWTR9H869ipBdpXCCQR1TStqaa0UrEn29lyXCfD38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060