UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fxC9+dLa0/PGFKgBa+gUtQjg9HvJeRfXHcyGM6+pSZI=' 
WHERE 
  key_id = '536677d583d5b6b7406e870c0922b37f29482472fa631f998a211fe5b4a061b8' 
  AND (
    token = 'fxC9+dLa0/PGFKgBa+gUtQjg9HvJeRfXHcyGM6+pSZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038