UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bsfMranGy5F6YGcoMWlDmKgdEKMbanQG4gxp5VWHwTU='
WHERE
key_id = 'd759ed657f108252e1a651a5df3c0e9b4ddbfa61f398584781fc328cee3904ca'
AND (
token = 'bsfMranGy5F6YGcoMWlDmKgdEKMbanQG4gxp5VWHwTU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)