UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+aefY7Qf85fY3PtCIoKtPX7p4snKDeb0dKl8Q1Qsp84='
WHERE
key_id = 'fc5f24fc5020a9e55dc128993b219c078a2ae5e47ace612527a1ffd77ad7cf75'
AND (
token = '+aefY7Qf85fY3PtCIoKtPX7p4snKDeb0dKl8Q1Qsp84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)