UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qyD1KdC4WBMJsRm3h4YDqWYyroeQQGfoqk5G7PMa86U='
WHERE
key_id = '112804d96abf544465088ab0ae217105306fa6a6d7d9e2b1c58afa2bf70b3531'
AND (
token = 'qyD1KdC4WBMJsRm3h4YDqWYyroeQQGfoqk5G7PMa86U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)