UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd3I41NLqx9wcQcDRmRdu4RA0NaNdsBeueS/PFeA+T+g='
WHERE
key_id = '573f0aa511c3cae75bd0a999b2fd4b1357a2e22d203b879c81691ce08d37e354'
AND (
token = 'd3I41NLqx9wcQcDRmRdu4RA0NaNdsBeueS/PFeA+T+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)