UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '87dxY6EtFsseCgNVtgJJRN9xkY/SXD+Ajalc3b8YFWk='
WHERE
key_id = 'f6227d0cc932dd018725a61aa9d3c51c1af9080cc8442cd12ddffb51bfd9b969'
AND (
token = '87dxY6EtFsseCgNVtgJJRN9xkY/SXD+Ajalc3b8YFWk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)