UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c0lewu1CKiki3barKBs8deCzPKHfM78ilPqdbsnq/CM='
WHERE
key_id = '5d8be5cee02326c6e11c6f624b341cd4547a32008ab03a20bac55f5c3d4f31d6'
AND (
token = 'c0lewu1CKiki3barKBs8deCzPKHfM78ilPqdbsnq/CM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)