UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0wKb5EK8xcpk9WWbMCvjajdIjP/mMww/DT/2FC9y3Gk='
WHERE
key_id = 'd4aa80b92371bda8e4a8e131ae18ca64878eefc2081d54de1a9006bf778d13a0'
AND (
token = '0wKb5EK8xcpk9WWbMCvjajdIjP/mMww/DT/2FC9y3Gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)