UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BPy1wlt4u2SYyHkq01lNqHEqdQviiqsnCEqQyt0tKmo='
WHERE
key_id = '0b848c6788a514d3f318637a05452b23dc6e59ab4289c297a52ba1cfa64662c6'
AND (
token = 'BPy1wlt4u2SYyHkq01lNqHEqdQviiqsnCEqQyt0tKmo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)