UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ug5zdDdvqyNVN2ehNnsWNJj844oz/WSlBzhHFfunGmQ='
WHERE
key_id = 'd3c2d0089db584fc036617cabfe99970a55010ac6a42816822882e502ed8414e'
AND (
token = 'ug5zdDdvqyNVN2ehNnsWNJj844oz/WSlBzhHFfunGmQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)