UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xfKpDAZO3PqXIZ3evTefdm0dOUPTSvbEGjQvI7r+zXI='
WHERE
key_id = 'd1b1bbe18e1ebc16b64e1feb1fe59bd302cb852cc77c796204acaaae3474b3f0'
AND (
token = 'xfKpDAZO3PqXIZ3evTefdm0dOUPTSvbEGjQvI7r+zXI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)