UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AganNWU6CtL3k5q5cMeKgxdxwiVwL2h7mjJONOX+NXg='
WHERE
key_id = 'fd98a7488412bb4bfd467fdf7364b228bbb5e7610e474a7ad16e65fe56f3efba'
AND (
token = 'AganNWU6CtL3k5q5cMeKgxdxwiVwL2h7mjJONOX+NXg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)