UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Btc0lxT0Qh9BhrfyasOVkwGhzbErYJER2CrNBicFKbk='
WHERE
key_id = '2e1660affafc0d7418f0c4750ba1e9ec358fe305c553ec30c26fc74186a7bb28'
AND (
token = 'Btc0lxT0Qh9BhrfyasOVkwGhzbErYJER2CrNBicFKbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)