UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r8AQUMN8X+aaZDSGl0n2aD6a5iqfj9NQk3hJ6aBEZMw='
WHERE
key_id = 'cfaf1bf63e1924f0515d54ccee6cacae3ea2f5a47cd89bc124dd1e81aeb242f9'
AND (
token = 'r8AQUMN8X+aaZDSGl0n2aD6a5iqfj9NQk3hJ6aBEZMw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)