UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A5xIQ/j7WcmkjPYkdESK/BN7z+IhBpe2x6zunI/Yo58='
WHERE
key_id = '590467ced0420a3f29b0df1d0c202110d3ff98e5654b8323f43dc5ad17671ceb'
AND (
token = 'A5xIQ/j7WcmkjPYkdESK/BN7z+IhBpe2x6zunI/Yo58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)