UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KB9Arh+coyBfByLmBHxDc7gu3+kQuMUiTk6UEzVkpg0='
WHERE
key_id = 'e9a5f0f2a5e802cca1f41404fe5bc3032a25c527875a65f224f1c887ba1d96c9'
AND (
token = 'KB9Arh+coyBfByLmBHxDc7gu3+kQuMUiTk6UEzVkpg0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)