UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5QR8zcz0y9cWpeo7nfsmDdTncdsqW+FC+H7cWEI4uWE='
WHERE
key_id = 'bff90c8b7d8685a27b57e8e49c3890c3201a2a4337246220d4550ad6672576c8'
AND (
token = '5QR8zcz0y9cWpeo7nfsmDdTncdsqW+FC+H7cWEI4uWE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)