UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ih5BHEXvCIpM91fSBVKXZ92A3kLF+zqDHglYeh+w+SI='
WHERE
key_id = 'c85ac6e4b0dedffc325221b5a99232f12b6c6dc84504cf941746720ec250a190'
AND (
token = 'ih5BHEXvCIpM91fSBVKXZ92A3kLF+zqDHglYeh+w+SI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)