UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pcIwyvJ5YCHg/+blQ0/n0pS5wWJ0+f06SI3xHH0Ya4g='
WHERE
key_id = 'ebca01271fcf511090fb7b90bc39e3f243a79b6e35c37a7fe5965056bd0e0de3'
AND (
token = 'pcIwyvJ5YCHg/+blQ0/n0pS5wWJ0+f06SI3xHH0Ya4g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)