UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oM0u+2xIYjTlsU2E1MFEoMSAMtwfBnTprsL22PnOp5E='
WHERE
key_id = 'da0ec456939042e87442fb1d42966b8ce579adb15eb59105237c9a9f05578bdc'
AND (
token = 'oM0u+2xIYjTlsU2E1MFEoMSAMtwfBnTprsL22PnOp5E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)