UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UMyaOzctpy/qCm7piQCcgE0qX5GJ8EwHc2Cn/KF3vsU='
WHERE
key_id = '550c6dc5d0535ff258eda688b116632f23f08893c8026d0317677e9f3eeea025'
AND (
token = 'UMyaOzctpy/qCm7piQCcgE0qX5GJ8EwHc2Cn/KF3vsU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)