UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yFaMBNIiTQiioNpE7mtNH469FN2AV0oZhfCyAyUB11s='
WHERE
key_id = 'c24a7fd3d8aadb63dca963b86997966aa28e847cad5f91f21d4e4f0967cf35dd'
AND (
token = 'yFaMBNIiTQiioNpE7mtNH469FN2AV0oZhfCyAyUB11s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)