UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kqLVMcEGJ51QOsOItPqaJjC0hC30uv2VHBcp/9eJciw='
WHERE
key_id = 'a1e20e4995126ab78553194b126552e68f0112b9ed1c5c6ec7d6735b3a04ccd8'
AND (
token = 'kqLVMcEGJ51QOsOItPqaJjC0hC30uv2VHBcp/9eJciw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)