UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HkXoA/xRl2GPVC/EU5Cbe5ifNYA7OMccWO45L0cs8Yo=' 
WHERE 
  key_id = 'fa4b4ff4626cceba99da5e4869ad0d2708e999419503c90022a68323e3cd3aad' 
  AND (
    token = 'HkXoA/xRl2GPVC/EU5Cbe5ifNYA7OMccWO45L0cs8Yo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046