UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RNMX2+krOtRoo6hxzdsypyH27T79ZmzQFVPW/Gh6EBM=' 
WHERE 
  key_id = 'dd218ea397930348e2ce990cb37b6616330621cf2b7c1601be14b3ac018c2d7d' 
  AND (
    token = 'RNMX2+krOtRoo6hxzdsypyH27T79ZmzQFVPW/Gh6EBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00094