UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KX9hY370q7yhbUnMkt9P/hy0eoP+4b42UaogxkOFgww='
WHERE
key_id = '3e1560363b6be9e2c80dddc2936368620dec1e1170de6f17393f2a4ea873c404'
AND (
token = 'KX9hY370q7yhbUnMkt9P/hy0eoP+4b42UaogxkOFgww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)