UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lpe8X7EFjJctzSh2hdc3tEfFNkQ6qyaapv4m5WuoC84='
WHERE
key_id = '0f9845ca3f02cf40334ed4284b220710d2f288301575d38e6081d7021fef18e9'
AND (
token = 'lpe8X7EFjJctzSh2hdc3tEfFNkQ6qyaapv4m5WuoC84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)