UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w5GHpAHf2c/QWFwzQWdpnC9TKUWu2MG41r6ZkRyP7UI='
WHERE
key_id = 'bfa7b982d60e2f0fa35a544a3b8d4edf6a59e409296e17c2370719b99b41ac71'
AND (
token = 'w5GHpAHf2c/QWFwzQWdpnC9TKUWu2MG41r6ZkRyP7UI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)