UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y/tCPdomnRUflGxquB8GpF6Cf52+C6Jg+wV8zktVGxM='
WHERE
key_id = '8a885a17059cad5397b812fff46f1283f4593f3293a70ae27dc6d301ed6cf4dc'
AND (
token = 'Y/tCPdomnRUflGxquB8GpF6Cf52+C6Jg+wV8zktVGxM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)