UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OEiy7qr+VE6tAPSQxv/xRuKLpQ2zaH3pLotHRh6BwRU=' 
WHERE 
  key_id = '8f520b522e51ca39c0ee231b677819b095536f13963e04c3f84857bdc3068f00' 
  AND (
    token = 'OEiy7qr+VE6tAPSQxv/xRuKLpQ2zaH3pLotHRh6BwRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042