UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l10EWo10Ay7Ic0P2891X4chUPgCmzOSAqRtcrX7RMmk=' 
WHERE 
  key_id = '51114e246d15ef348a0b8e5d5c59328f8e23b6066f8a0616c21ad817cce3d992' 
  AND (
    token = 'l10EWo10Ay7Ic0P2891X4chUPgCmzOSAqRtcrX7RMmk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032